#Makefile for the userspace OHSM code.

PROG = ohsm
CC = cc
CFLAGS = `xml2-config --cflags --libs`
RM = rm
CLEANUP_FILES = *.o $(PROG)
EXTRA_CFLAGS = -c 
INCLUDE = ../include/
LIBS = ldevmapper


all: $(PROG)
	
ohsm: ohsm.o parse_alloc_file.o parse_reloc_file.o parse_device_file.o validate.o dev_topology.o debug.o allocate.o relocate.o
	$(CC) -o ohsm ohsm.o parse_alloc_file.o parse_reloc_file.o parse_device_file.o validate.o dev_topology.o debug.o allocate.o relocate.o $(CFLAGS) -$(LIBS)

ohsm.o: ohsm.c 
	$(CC) -c ohsm.c $(CFLAGS) 

dev_topology.o: dev_topology.c 
	$(CC) -c dev_topology.c $(CFLAGS) 

parse_alloc_file.o: parse_alloc_file.c 
	$(CC) -c parse_alloc_file.c $(CFLAGS) 

parse_reloc_file.o: parse_reloc_file.c 
	$(CC) -c parse_reloc_file.c $(CFLAGS) 

parse_device_file.o: parse_device_file.c 
	$(CC) -c parse_device_file.c $(CFLAGS) 

validate.o: validate.c 
	$(CC) -c validate.c $(CFLAGS)  

debug.o: debug.c 
	$(CC) -c debug.c $(CFLAGS) 

allocate.o: allocate.c 
	$(CC) -c allocate.c $(CFLAGS) 

relocate.o: relocate.c 
	$(CC) -c relocate.c $(CFLAGS) 

install:
	cp -pf ohsm /sbin/ohsm

clean:
	$(RM) -rf $(CLEANUP_FILES)

distclean:
	/bin/rm -f Makefile config.h config.status config.cache config.log
	/bin/rm -rf autom4te.cache 
	/bin/rm -rf autoscan.log 
